import { BrowserRouter as Router, Route, Switch, Redirect } from 'react-router-dom'
import '@/App.scss'
import Login from '@/pages/Login'
import Layout from '@/pages/Layout'

export default function App() {
  return (
    <Router>
      <Switch>
        {/* Redirect 组件 from 属性：必须丢在 Switch 中，才能生效 */}
        <Redirect exact from='/' to='/home'></Redirect>
        {/* <Route exact path='/' render={() => <Redirect to='/login'></Redirect>}></Route> */}
        <Route path='/login' component={Login}></Route>
        <Route path='/home' component={Layout}></Route>
      </Switch>
    </Router>
  )
}
